package com.mysoft.gfyx.common.table.impl;

import com.mysoft.framework.common.user.User;
import com.mysoft.framework.core.function.authorization.AuthenticationUser;
import com.mysoft.framework.modeling.dto.Filter;
import com.mysoft.framework.modeling.dto.LoadDataParams;
import com.mysoft.framework.modeling.dto.SqlCondition;
import com.mysoft.gfyx.common.table.LoadDataApiServiceHelper;
import com.mysoft.sdk.context.core.ThreadContextHolder;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class LoadDataApiServiceHelperImpl implements LoadDataApiServiceHelper {
    public void addOneOptionFilter(LoadDataParams options, String field, String operatorType, String value) {
        SqlCondition s = new SqlCondition();
        s.setField(field);
        s.setOperatorType(operatorType);
        s.setValue(value);
        List<SqlCondition> conditions = new ArrayList<>();
        conditions.add(s);
        Filter filter = new Filter();
        filter.setCondition(conditions);
        filter.setType("and");
        List<Filter> filters = new ArrayList<>();
        filters.add(filter);
        options.getOptions().getFilters().add(filter);
    }
}
